//
//  HyCollectionViewCell.m
//  豆瓣
//
//  Created by hy on 16/1/7.
//  Copyright © 2016年 hongyu. All rights reserved.
//

#import "HyCollectionViewCell.h"

@implementation HyCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)dealloc {
    [_hyLabel release];
    [_hyImageView release];
    [super dealloc];
}

- (void)creatCell {
    self.hyImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_hyImageView];
    [_hyImageView release];
    
    self.hyLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_hyLabel];
    [_hyLabel release];
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
    _hyImageView.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.size.height);
    _hyImageView.backgroundColor = [UIColor redColor];
    
    _hyLabel.frame = CGRectMake(0, _hyImageView.frame.size.height - 30, layoutAttributes.frame.size.width, 30);
    _hyLabel.backgroundColor = [UIColor purpleColor];
    _hyLabel.alpha = 0.8;
    _hyLabel.textColor = [UIColor whiteColor];
    _hyLabel.textAlignment = NSTextAlignmentCenter;
}
@end
